package come.my.test;

public class day14 {
    public static void main(String[] args) {
        Account account = new Account();
        account.setName("袁浪");
        account.setMoney(2);
        account.setMima("1");

        account.info();
    }
}
class Account
{
    private String name;
    private double money;
    private String mima;

    public Account() {
    }

    public Account(String name,double money,String mima) {
        this.name=name;
        this.money=money;
        this.mima = mima;
    }

    public String getMima() {
        return mima;
    }

    public void setMima(String mima) {
        if(mima.length()>=6) {
            this.mima = mima;
        }
        else {
            this.mima ="111111";
            System.out.println("密码不正确,密码必须为六位,默认为111111");

        }
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        if(money>20) {
            this.money = money;
        }
        else {
            System.out.println("余额不足,默认为0");
            this.money=0;
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if(name.length()==2||name.length()==3||name.length()==4) {
            this.name = name;
        }
        else{
            System.out.println("名字不符合表准,默认为无名");
            this.name="无名";
        }
    }
    public void info()
    {
        System.out.println("信息如下");
        System.out.println("名字"+this.name+"  密码"+this.mima+"  钱"+this.money);
    }
}
